Skip to main content

Paginated request guidelines

All HTTP paginated requests in Corvina platform are based on the following conventions:

  • The request can contain a page query parameter with the page number 0-based (default 0).
  • The request can contain a pageSize query parameter with the page size (default 10).
  • The request can contain a orderBy query parameter with the field name to order by (the default value depends on your use case, in many cases we use id or updatedAt).
  • The request can contain a orderDir query parameter with the order direction, the value could be ASC or DESC (the default value depends on your case, in many cases DESC).

The response is a JSON like this:

{
// The items of the current page
"content": [
{}, {}, {}, {}, {}, {}, {}, {}, {}, {}
],
// The total number of pages
"totalPages": 3,
// The total number of elements
"totalElements": 27,
// A boolean flag indicating if the current page is the last page
"last": false,
// The current page number (corresponding to the request page parameter)
"number": 0,
// The requested page size (corresponding to the request pageSize parameter)
"size": 10
}
tip

If you follow this convention, it'll be easier for other developers to use your API. We follow this convention even in the app that we develop internally or for our customers.